
use "$hssc_robust_women_marital.dta", clear

global wf        m_age m_eduyr m_goodhlth m_pens m_ins
global household pid_c1_gender landrentout transinc hhnetasst
global covar     dm_unmarr dm_marr_nochild dm_marr_child

*Table A1
*Descriptive statistics of women's marital and parental status
***********************************************************************************************
***********************************************************************************************
reg numchldtot $covar 
outreg2 using table1,sum replace word excel dec(3) 
reg numchldtot $covar if treat_it == 1
outreg2 using table1,sum append word excel dec(3)
reg numchldtot $covar if treat_it == 0
outreg2 using table1,sum append word excel dec(3)

local i = 0
foreach x of varlist $covar {
         local i = `i' + 1
         gen var`i'=`x'            
}
mat T = J(3,4,.) 
forvalues i = 1 2 to 3 {
                  ttest var`i' ,by (treat_it)
                  mat T[`i',1]= r(mu_2)
				  mat T[`i',2]= r(mu_1)
                  mat T[`i',3]= r(mu_2)-r(mu_1)
                  mat T[`i',4]= r(p)
}
mat rownames T = $covar 
logout, save(myfile) excel replace: /// 
frmttable using diff_test,statmat(T) replace sdec(3) ctitles (varname, treatment, control, Diff, p-value)
drop var*

*Table 4 
*Estimation results accounting for women's marital and parental status
***********************************************************************************************
***********************************************************************************************
reghdfe numchldtot   treat_it $wf $household , a(pid_a_m year) vce(robust) keepsingletons
est store model_1
reghdfe numchldtot   treat_it $wf $household dm_marr_nochild dm_marr_child, a(pid_a_m year) vce(robust) keepsingletons
est store model_2
outreg2 [model_*] using table1,replace  word excel  dec(3) alpha(0.01, 0.05, 0.1)  addtext(Year FE, Yes, Individual FE, Yes)  



